<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<!-- Casting SPELs in Lisp - Emacs Lisp Edition, a Comic Book
     Written by Conrad Barski, M.D., http://lisperati.com
     Edited by James A. Webb, http://uberkode.com -->

<head>

  <title>Casting SPELs in Lisp (14)</title>
  <meta http-equiv="content-type" content="text/html;charset=utf-8" />
  <meta http-equiv="Content-Style-Type" content="text/css" />
  <meta name="author" content="James A. Webb" />
  <meta name="date" content="2007-09-15T00:00:00+00:00" />
  <meta name="keywords" content="Emacs, Lisp" />

</head>

<body>

<center>

<table cellspacing="10" width="500">
  <tr>
    <td>
      To find the description for this, it first needs to look up the
      spot in the map that points to the living-room. The
      <tt>assoc</tt> command does this and then returns the data
      describing the living-room. Then the command <tt>second</tt>
      trims out the second item in that list, which is the
      description of the living-room (If you look at the <tt>map</tt>
      variable we had created, the snippet of text describing the
      <tt>living-room</tt> was the second item in the list that
      contained <i>all</i> the data about the living room...)
    </td>
  </tr>
  <tr>
    <td>
      Now let's use our Emacs scratch buffer to test our function. 
      Again, like all the text in  <span style="font-family: monospace; 
      font-weight: bolder; color:darkblue">this font and color</span>, 
      copy and paste the following text into your Emacs
      <tt>*scratch*</tt> buffer, move the cursor to the end of it,
      and type <tt>C-x C-e</tt> to execute it:
    </td>
  </tr>
  <tr>
    <td>
<pre style="font-weight: bolder; color: darkblue">
  (describe-location 'living-room map)
</pre>
    </td>
  </tr>
  <tr>
    <td>
      If you copied all the code into the Emacs <tt>*scratch*</tt> 
      buffer correctly up to this point, you should see the following 
      message:
    </td>
  </tr>
  <tr>
    <td>
<pre style="font-weight: bolder; color: darkgreen">
  ==> (you are in the living-room of a wizards house - 
       there is a wizard snoring loudly on the couch -)
</pre>
    </td>
  </tr>
  <tr>
    <td>
      Perfect! Just what we wanted! Notice how we put a quote in 
      front of the symbol <tt>living-room</tt>, since this symbol is 
      just a piece of data naming the location (i.e., we want it read 
      in <i>Data</i> mode), but why didn't we put a quote in front of 
      the symbol <tt>map</tt>, since in this case we want the Lisp 
      interpreter to hunt down the data stored in the <tt>map</tt> 
      variable (i.e., we want the compiler to be in <i>Code</i> mode 
      and not just look at the word <tt>map</tt> as a chunk of raw data).
    </td>
  </tr>
  <tr>
    <td align="center">
      &lt;&lt; <a href="casting-spels-emacs-1.html">begin</a>
      &lt; <a href="casting-spels-emacs-13.html">previous</a> - 
      <a href="casting-spels-emacs-15.html">next</a> &gt;
      <a href="casting-spels-emacs-35.html" >end</a> &gt;&gt;
    </td>
  </tr>
</table>

</center>

</body>

</html>